<?php
/**
 * 描述：会员注册-电子邮件验证。
 * @final
 */
final class Exec_Account_Register_Email extends Exec
{
    public function Get()
    {
        #获取参数
        $number=Functions::UrlArgs('number');

        #获取数据
        $data=DB::PGetRows('select * from account_email_wait where Number=? order by ID desc',array(
            $number
        ));

        #验证逻辑
        View::Assign('Title','会员注册');
        if($data)
        {
            if(Functions::DateDiff($data[0]['Datetime'])<=3)
            {
                //添回到己经通过验证的表中
                DB::Insert('account_email_verification',array(
                    'Account'=>$data[0]['Account']
                ));

                //删除验证完的信息                
                DB::PExec('delete from account_email_wait where Account=?',array(
                    $data[0]['Account']
                ));

                View::Assign('Content','邮件验证成功，点击<a href="/exec.php?action=account_login_login" target="_self">登录</a>。');
            }
            else{
                View::Assign('Content','验证码己经过期，点击<a href="/exec.php?action=account_register_resend" target="_self">重新发送</a>验证邮件！');
            }
        }
        else{
            View::Assign('Content','验证码己经过期，点击<a href="/exec.php?action=account_register_resend" target="_self">重新发送</a>验证邮件。');
        }

        #显示页面
        View::Display('account/public.container.tpl');
    }
}
?>